<template>
	<view>
		<view v-for="(item,index) in listobj" :key="index"
			style="display: flex;justify-content: space-between;padding: 20px 10px;align-items: center;">
			<view @click="getitem(item.id)"
				style="display: flex;flex-direction: row;align-items: center;margin-left: ; ">
				<image :src="item.url"
					style="width: 25px;height: 25px;padding: 5px;background-color: #007AFF;border-radius: 5px;"></image>
				<view style="display: flex;flex-direction: column;margin-left: 2vw;">
					<text>{{item.name}}</text>
					<text style="font-size: 10px;color: #666666;">{{item.discribe}}</text>
				</view>
			</view>
			<text @click="listobj[index].show=0" v-if="item.show==1"
				style="font-size: 13px; color: #999999; width: text-align: center; 15vw; padding: 2px 6px;border-radius: 2px;border:#999999 solid 1px;">取消关注</text>
			<text v-else-if="item.show==0" @click="listobj[index].show=1"
				style="font-size: 13px; color: #ffffff; width: 15vw;text-align: center;  padding: 2px 6px;border-radius: 2px;background-color: #007AFF;">关注</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				listobj: [{
						id: 1,
						name: "理发",
						url: "../../../static/img/scissors.png",
						discribe: "按照残疾人需求，为残疾人上门理发。",
						show: 1
					},
					{
						id: 2,
						name: "助医",
						url: "../../../static/img/doctor.png",
						discribe: "陪同残疾人到医院就诊",
						show: 1
					},
					{
						id: 3,
						name: "洗涤",
						url: "../../../static/img/Dryclothes.png",
						discribe: "清洗残疾人衣物等",
						show: 1
					},
					{
						id: 4,
						name: "助浴",
						url: "../../../static/img/shower.png",
						discribe: "清洗残疾人衣物等",
						show: 1
					},
					{
						id: 5,
						name: "个人护理",
						url: "../../../static/img/tubiao_-.png",
						discribe: "助残疾人整理个人卫生",
						show: 1
					},
					{
						id: 6,
						name: "精神慰藉",
						url: "../../../static/img/ad.png",
						discribe: "助残疾人舒缓心情",
						show: 1

					},
					{
						id: 7,
						name: "康复训练",
						url: "../../../static/img/trin.png",
						discribe: "帮助残疾人进行康复",
						show: 1
					}
				],
			}
		},
		methods: {
			getitem: function(id) {

				console.log(id)

				uni.navigateTo({
					url: `../serviceInfo/serviceInfo?id=${id}`
				})
			},
		},
		onUnload() {
		uni.setStorage({
		    key: 'storage_icondata',
		    data: this.listobj,
		    success: function () {
		        console.log('success');
		    }
		})
		},
		onLoad() {
			uni.getStorage({
				key: 'storage_icondata',
				success: (res)=> {
					console.log(res.data);
					
						this.listobj = res.data
					
		
				}
			});
		}
	}
</script>

<style>

</style>
